<!--
 * @Author: 龚燎原 274473435@qq.com
 * @Date: 2023-12-09 15:43:41
 * @LastEditors: 龚燎原
 * @LastEditTime: 2023-12-10 15:24:02
-->
<template>
    <el-dialog :title="title" :visible.sync="dialogVisible" width="500px" append-to-body>
        <el-form ref="form" :model="form" :rules="rules" label-width="120px">
            <el-form-item label="实际卖气量(立方)" prop="factAmount">
                <el-input v-model="form.factAmount" placeholder="请输入实际卖气量(立方)" />
            </el-form-item>
            <el-form-item label="一枪编号" prop="firstGunNum">
                <el-input v-model="form.firstGunNum" placeholder="请输入一枪编号" />
            </el-form-item>
            <el-form-item label="二枪编号" prop="secondGunNum">
                <el-input v-model="form.secondGunNum" placeholder="请输入二枪编号" />
            </el-form-item>
            <el-form-item label="三枪编号" prop="thirdGunNum">
                <el-input v-model="form.thirdGunNum" placeholder="请输入三枪编号" />
            </el-form-item>
            <el-form-item label="一枪气量" prop="firstGunAmount">
                <el-input v-model="form.firstGunAmount" placeholder="请输入一枪气量" />
            </el-form-item>
            <el-form-item label="二枪气量" prop="secondGunAmount">
                <el-input v-model="form.secondGunAmount" placeholder="请输入二枪气量" />
            </el-form-item>
            <el-form-item label="三枪气量" prop="thirdGunAmount">
                <el-input v-model="form.thirdGunAmount" placeholder="请输入三枪气量" />
            </el-form-item>
            <el-form-item label="一枪完成时间" prop="firstGunFinishTime">
                <el-date-picker clearable v-model="form.firstGunFinishTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
                    placeholder="请选择一枪完成时间">
                </el-date-picker>
            </el-form-item>
            <el-form-item label="二枪完成时间" prop="secondGunFinishTime">
                <el-date-picker clearable v-model="form.secondGunFinishTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
                    placeholder="请选择二枪完成时间">
                </el-date-picker>
            </el-form-item>
            <el-form-item label="三枪完成时间" prop="thirdGunFinishTime">
                <el-date-picker clearable v-model="form.thirdGunFinishTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
                    placeholder="请选择三枪完成时间">
                </el-date-picker>
            </el-form-item>
            <el-row type="flex" justify="end">
                <el-button type="primary" @click="submitForm">提交</el-button>
                <el-button @click="cancel">取消</el-button>
            </el-row>
        </el-form>
    </el-dialog>
</template>
    
<script>

export default {
    name: "ExtSale",
    data() {
        return {
            dialogVisible: false,
            title: '',
            // 表单参数
            form: {},
            // 表单校验
            rules: {
            }
        };
    },
    created() {

    },
    methods: {
        open(data) {
            this.form = Object.assign({}, data)
            this.title = "调度信息"
            this.dialogVisible = true
        },
        // 取消按钮
        cancel() {
            this.reset();
            this.dialogVisible = false
            // this.$emit("cancel")
        },
        // 表单重置
        reset() {
            this.form = {};
        },
        /** 提交按钮 */
        submitForm() {
            this.$refs["form"].validate(valid => {
                if (valid) {
                    const { saleRecordId, factAmount, firstGunNum, secondGunNum, thirdGunNum, firstGunAmount, secondGunAmount, thirdGunAmount, firstGunFinishTime, secondGunFinishTime, thirdGunFinishTime } = this.form
                    this.$emit('submit', { saleRecordId, factAmount, firstGunNum, secondGunNum, thirdGunNum, firstGunAmount, secondGunAmount, thirdGunAmount, firstGunFinishTime, secondGunFinishTime, thirdGunFinishTime })
                }
            });
        }
    }
};
</script>
    